﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:common="using:Dynamics.NAV.Metro.Common">

    <common:StringFormatConverter x:Key="StringFormatConvert" />

    <Style x:Key="GLDBasicTextStyle" TargetType="TextBlock">
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}"/>
        <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/>
        <Setter Property="TextTrimming" Value="WordEllipsis"/>
        <Setter Property="TextWrapping" Value="Wrap"/>
        <Setter Property="Typography.StylisticSet20" Value="True"/>
        <Setter Property="Typography.DiscretionaryLigatures" Value="True"/>
        <Setter Property="Typography.CaseSensitiveForms" Value="True"/>
    </Style>

    <Style x:Key="GLDBaselineTextStyle" TargetType="TextBlock" BasedOn="{StaticResource GLDBasicTextStyle}">
        <Setter Property="LineHeight" Value="20"/>
        <Setter Property="LineStackingStrategy" Value="BlockLineHeight"/>
    </Style>

    <Style x:Key="GLDHeaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource GLDBaselineTextStyle}">
        <Setter Property="FontSize" Value="36"/>
        <Setter Property="FontWeight" Value="Light"/>
        <Setter Property="LineHeight" Value="40"/>
        <Setter Property="RenderTransform">
            <Setter.Value>
                <TranslateTransform X="-2" Y="8"/>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="GLDSubheaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource GLDBaselineTextStyle}">
        <Setter Property="FontSize" Value="26.667"/>
        <Setter Property="FontWeight" Value="Light"/>
        <Setter Property="LineHeight" Value="30"/>
        <Setter Property="RenderTransform">
            <Setter.Value>
                <TranslateTransform X="-1" Y="6"/>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="GLDTitleTextStyle" TargetType="TextBlock" BasedOn="{StaticResource GLDBaselineTextStyle}">
        <Setter Property="FontWeight" Value="SemiBold"/>
    </Style>

    <Style x:Key="GLDSubtitleTextStyle" TargetType="TextBlock" BasedOn="{StaticResource GLDBaselineTextStyle}">
        <Setter Property="FontWeight" Value="Normal"/>
    </Style>

    <Style x:Key="GLDItemTextStyle" TargetType="TextBlock" BasedOn="{StaticResource GLDBaselineTextStyle}"/>

    <Style x:Key="GLDBodyTextStyle" TargetType="TextBlock" BasedOn="{StaticResource GLDBaselineTextStyle}">
        <Setter Property="FontWeight" Value="SemiLight"/>
    </Style>

    <Style x:Key="GLDCaptionTextStyle" TargetType="TextBlock" BasedOn="{StaticResource GLDBaselineTextStyle}">
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="Foreground" Value="{StaticResource ApplicationSecondaryForegroundThemeBrush}"/>
    </Style>

    <DataTemplate x:Key="GLDAccountTemplate">
        <Grid Background="AliceBlue">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding PostingDate, Converter={StaticResource StringFormatConvert}, ConverterParameter='{}{0:d}'}" Grid.Column="1" Width="100" Style="{StaticResource GLDTitleTextStyle}" />
            <TextBlock Text="{Binding DocumentType}" Grid.Column="2" Width="100" Style="{StaticResource GLDTitleTextStyle}" TextWrapping="NoWrap"/>
            <TextBlock Text="{Binding DocumentNo}" Grid.Column="3" Width="100" Style="{StaticResource GLDTitleTextStyle}" TextWrapping="NoWrap"/>
            <TextBlock Text="{Binding Description}" Grid.Column="4" Width="350" Style="{StaticResource GLDTitleTextStyle}" TextWrapping="NoWrap"/>
            <TextBlock Text="{Binding GlobalDimension1Code}" Grid.Column="5" Width="100" Style="{StaticResource GLDTitleTextStyle}" TextWrapping="NoWrap"/>
            <TextBlock Text="{Binding GlobalDimension2Code}" Grid.Column="6" Width="100" Style="{StaticResource GLDTitleTextStyle}" TextWrapping="NoWrap"/>
            <TextBlock Text="{Binding Amount, Converter={StaticResource StringFormatConvert}, ConverterParameter='{}{0:C}'}" Grid.Column="7" TextAlignment="Right" Width="100" Style="{StaticResource GLDTitleTextStyle}" TextWrapping="NoWrap"/>
            <TextBlock Text="{Binding BalAccountType}" Grid.Column="8" Padding="10,0,0,0" Width="100" Style="{StaticResource GLDTitleTextStyle}" TextWrapping="NoWrap"/>
            <TextBlock Text="{Binding BalAccountNo}" Grid.Column="9" TextAlignment="Right" Width="100" Style="{StaticResource GLDTitleTextStyle}" TextWrapping="NoWrap"/>
            <TextBlock Text="{Binding EntryNo}" Grid.Column="10" TextAlignment="Right" Width="100" Style="{StaticResource GLDTitleTextStyle}" TextWrapping="NoWrap"/>
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="GLDAccount80Template">
        <Grid Margin="6">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <StackPanel Grid.Column="1" Margin="10,0,0,0">
                <TextBlock Text="{Binding No}" Style="{StaticResource ItemTextStyle}" MaxHeight="40"/>
                <TextBlock Text="{Binding Name}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap"/>
            </StackPanel>
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="GLDAccountDetailTemplate">
        <Grid>
            <StackPanel VerticalAlignment="Top" Margin="110,127,117,0">
                <TextBlock Text="{Binding No}" Style="{StaticResource ItemTextStyle}" MaxHeight="40"/>
                <TextBlock Text="{Binding Name}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap"/>
                <TextBlock Text="{Binding Balance}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap"/>
            </StackPanel>
        </Grid>
    </DataTemplate>
</ResourceDictionary>
